<html>
<head>
  <script type="text/javascript" src="../../ImageJS/ipij/Tools.object.js"></script>
  <script type="text/javascript" src="../Tree2d.js"></script>
  <script type="text/javascript" src="../Clustering.object.js"></script>
  <script type="text/javascript" src="../Plot.class.js"></script>
  <script type="text/javascript" src="../Plot_tools.js"></script>
  <script type="text/javascript" src="../Plot_ui.js"></script>
  <script type="text/javascript" src="../Plot_events.js"></script>

  <script type="text/javascript">
  var plot = new Plot('main-plot', 512, 512);
  var data;
  
  function assume(condition, message) {
    if (!condition) {
        alert(message);
        throw new Error('Error: ' + message);
    }
  }
  
  function init() {
    document.body.appendChild(plot.getDrawing());
    Tools.makeDraggable(document, load, 'text');
  }
  
  function load(csv) {
    data = Plot.loadCsv(csv);
    assume(data.length >= 2, 'Data must have 2 coordinates');
    plot.clear();
    plot.plot(data[1], data[0], '#5 -r2');
  }
  </script>
</head>
<body onload="init();">
</body>
</html>